package model;

import java.math.BigDecimal;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.time.LocalDateTime;

public class Store {
    private Long          st_id;
    private Long          u_id;
    private String        st_name;
    private LocalDateTime st_ctime;
    private BigDecimal    st_bank;
    private String        st_state;
    private String        st_pic_address;

    public Store(Long st_id, Long u_id, String st_name, LocalDateTime st_ctime, BigDecimal st_bank, String st_state, String st_pic_address) {
        this.st_id          = st_id;
        this.u_id           = u_id;
        this.st_name        = st_name;
        this.st_ctime       = st_ctime;
        this.st_bank        = st_bank;
        this.st_state       = st_state;
        this.st_pic_address = st_pic_address;
    }

    public Store(Object[] recRow) {
        this.st_id          = (Long)recRow[0];
        this.u_id           = (Long)recRow[1];
        this.st_name        = (String)recRow[2];
        this.st_ctime       = (LocalDateTime)recRow[3];
        this.st_bank        = (BigDecimal)recRow[4];
        this.st_state       = (String)recRow[5];
        this.st_pic_address = (String)recRow[6];
    }

    public Store(ResultSet rs) throws SQLException {
        this.st_id          = rs.getLong("st_id");
        this.u_id           = rs.getLong("u_id");
        this.st_name        = rs.getString("st_name");
        this.st_ctime       = rs.getTimestamp("st_ctime").toLocalDateTime();
        this.st_bank        = rs.getBigDecimal("st_bank");
        this.st_state       = rs.getString("st_state");
        this.st_pic_address = rs.getString("st_pic_address");
    }

    public Long getSt_id() {
        return st_id;
    }

    public void setSt_id(Long st_id) {
        this.st_id = st_id;
    }

    public Long getU_id() {
        return u_id;
    }

    public void setU_id(Long u_id) {
        this.u_id = u_id;
    }

    public String getSt_name() {
        return st_name;
    }

    public void setSt_name(String st_name) {
        this.st_name = st_name;
    }

    public LocalDateTime getSt_ctime() {
        return st_ctime;
    }

    public void setSt_ctime(LocalDateTime st_ctime) {
        this.st_ctime = st_ctime;
    }

    public BigDecimal getSt_bank() {
        return st_bank;
    }

    public void setSt_bank(BigDecimal st_bank) {
        this.st_bank = st_bank;
    }

    public String getSt_state() {
        return st_state;
    }

    public void setSt_state(String st_state) {
        this.st_state = st_state;
    }

    public String getSt_pic_address() {
        return st_pic_address;
    }

    public void setSt_pic_address(String st_pic_address) {
        this.st_pic_address = st_pic_address;
    }
}
